function slider(RangeNum) {
  this.RangeValue =new Array();
  for(var i=0;i<RangeNum;i++){
    this.RangeValue[i] = 50;
  }
  this.upslider=function (e,ShowName){
    var i =e.id.charAt(5);
    var name = ShowName+i;
    this.RangeValue[i-1]=e.value;
    document.getElementById(name).value=e.value;
    mychart.refreshData(this.RangeValue);
  }
  this.upinput=function (e,RangeName){
        if(e.value<=100&&e.value>0){
            var i =e.id.charAt(4);
            var name = RangeName+i;
            this.RangeValue[i-1]=e.value;
            document.getElementById(name).value=e.value;
            mychart.refreshData(this.RangeValue);
            }
        else{
          dialog.alert({
          title:"警告",
          msg:'输入超出限程！',
          buttons:['确定']},function(ret) {
            //console.log(ret);
          });
        }
        };

  }


function UpdataInput(InputName){   //input监听
  document.getElementById(InputName).addEventListener("change",function(){//监听range
        console.log(document.getElementById(InputName).value);
          });
}



// 刷新图像函数
// @return 无
//
var Chart = (function(ChartId,Data) {
    this.chart= echarts.init(document.getElementById(ChartId));
    this.CreatChart_Bar = function(Data){
      var option = {
          title: {
              x: 'left',
              text: '设备当前状态图示',
              subtext: ['Time:5：30','Model:手动']
          },
          tooltip: {

              trigger: 'item',
              position:function(p){   //其中p为当前鼠标的位置
                  return [p[0] + 10, p[1] - 10];
                  }
          },

          calculable: true,
          grid: {
              borderWidth: 0,
              y: 80,
              y2: 60
          },
          xAxis: [
              {
                  type: 'category',
                  show: false,
                  data: ['Red', 'Yellow', 'Blue', 'White','Radar', 'Chord']
              }
          ],
          yAxis: [
              {
                  type: 'value',
                  show: false
              }
          ],
          series: [
              {

                  type: 'bar',
                  itemStyle: {
                      normal: {
                          color: function(params) {
                              // build a color map as your need.
                              var colorList = [
                                '#C1232B','#B5C334','#FCCE10','#E87C25','#27727B',
                                 '#FE8463'
                              ];
                              return colorList[params.dataIndex]
                          },
                          label: {
                              show: true,
                              position: 'top',
                              formatter: '{b}\n{c}'
                          }
                      }
                  },
                  data: Data,

              }
          ]
      };
      this.chart.setOption(option);
  }
    this.refreshData=function(){
         if(!this.chart){
              return;
         }
          var option = this.chart.getOption();
          option.series[0].data = Data;
          this.chart.setOption(option);
    }
});
